package com.jobjoin.jobjoin.user.controller;


import com.jobjoin.jobjoin.common.util.R;
import com.jobjoin.jobjoin.user.entity.Resume;
import com.jobjoin.jobjoin.user.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 简历表 一个求职者可以有多份简历 前端控制器
 * </p>
 *
 * @author WinsomeC
 * @since 2021-04-18
 */
@RestController
@RequestMapping("/user/resume")
public class ResumeController {
    @Autowired
    private ResumeService resumeService;

    @PostMapping("/addResume")
    public R addResume(Resume resume){
        boolean save = resumeService.save(resume);
        if(save){
            return R.ok();
        }else{
            return R.error();
        }
    }
    @GetMapping
    public R getResume(){
        List<Resume> list = resumeService.list(null);
        return R.ok().data("items",list);
    }

    @DeleteMapping("{id}")
    public boolean deleteResumeById(@PathVariable String id){
        boolean b = resumeService.removeById(id);
        return b;
    }
}

